import request from '@/utils/request'

// 查询商品规格列表
export function listShopNormsAfter(query) {
  return request({
    url: '/shop/normsAfter/list',
    method: 'get',
    params: query
  })
}

// 查询商品规格详细
export function getShopNormsAfter(id) {
  return request({
    url: '/shop/normsAfter/' + id,
    method: 'get'
  })
}

// 新增商品规格
export function addShopNormsAfter(data) {
  return request({
    url: '/shop/normsAfter',
    method: 'post',
    data: data
  })
}

// 修改商品规格
export function updateShopNormsAfter(data) {
  return request({
    url: '/shop/normsAfter',
    method: 'put',
    data: data
  })
}

// 删除商品规格
export function delShopNormsAfter(id) {
  return request({
    url: '/shop/normsAfter/' + id,
    method: 'delete'
  })
}

//新增商品规格信息及商品规格值信息
export function addShopNormsInfo(data) {
  return request({
    url: '/shop/normsAfter/insertNormsInfo',
    method: 'post',
    data: data
  })
}

//根据商品id查询规格信息
export function getShopNormsInfo(shopActiveId){
  return request({
    url: '/shop/normsAfter/getNormsList/' + shopActiveId,
    method: 'get'
  })
}

//根据商品id查询规格信息
export function getShopNormsInfoByAll(){
  return request({
    url: '/shop/normsAfter/getAllNormsList' ,
    method: 'get'
  })
}

//根据商品id修改启用状态为开启
export function updateStart(data){
  return request({
    url: '/shop/normsAfter/updateStart',
    method: 'put',
    data: data
  })
}
//根据商品id修改启用状态为开启
export function updateNoStart(data){
  return request({
    url: '/shop/normsAfter/updateNoStart',
    method: 'put',
    data: data
  })
}

//根据商品id查询商品规格值信息
export function getNormsValueList(shopActiveId){
  return request({
    url: '/shop/normsAfter/getNormsValueList/' + shopActiveId,
    method: 'get'
  })
}

//根据商品规格id删除商品规格信息及商品规格值信息
export function deleteNormsValue(id){
  return request({
    url:'/shop/normsAfter/deleteNormsById/'+id,
    method:'delete'
  })
}

//根据商品规格id查询商品规格及商品规格值信息
export function getNormsUpdateById(id){
  return request({
    url: '/shop/normsAfter/getUpdateNorms/' + id,
    method: 'get'
  })
}

//根据id更新商品规格信息及商品规格值信息(更新弹窗)
export function updateNormsById(data){
  return request({
    url: '/shop/normsAfter/updateNormsById',
    method: 'put',
    data: data
  })
}
